/*
 * Copyright (c) 2020 Carnegie Lee
 * All rights reserved
 */
package com.geekc.threadpool.pool;

import com.geekc.threadpool.pool.impl.DefaultThreadPool;

import java.util.concurrent.Callable;
import java.util.concurrent.Future;

/**
 * 线程池
 * @author Carnegie Lee
 */
public interface ThreadPool {

    /**
     * 构造ThreadPool
     */
    public DefaultThreadPool build();

    /**
     * 无返回值提交任务
     * @param runnable
     */
    public void execute(Runnable runnable);

    /**
     * 有返回值提交任务
     * @param callable
     * @return
     */
    public <T> Future<T> submit(Callable<T> callable);

    /**
     * 关闭线程池
     */
    public void shutdown();
}
